Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

baselineprofile/src/main/kotlin/org/meshtastic/baselineprofile/BaselineProfileGenerator.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 2.56 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.baselineprofile

Tff7b72import T7ee787androidx.benchmark.macro.junit4.BaselineProfileRule
Tff7b72import T7ee787androidx.test.ext.junit.runners.AndroidJUnit4
Tff7b72import T7ee787androidx.test.filters.LargeTest
Tff7b72import T7ee787androidx.test.platform.app.InstrumentationRegistry
Tff7b72import T7ee787org.junit.Rule
Tff7b72import T7ee787org.junit.Test
Tff7b72import T7ee787org.junit.runner.RunWith

T8b949e/**
* Generates a Baseline Profile for the app's critical user journey.
*
* Run it with:
* ```
* ./gradlew :androidApp:generateGoogleReleaseBaselineProfile
* ```
*
* The [androidx.baselineprofile] plugin on `:androidApp` drives this against the auto-created
* `nonMinifiedRelease` variant and merges the result into
* `androidApp/src/googleRelease/generated/baselineProfiles/`. Commit that output so release builds ship
* it.
*
* The journey is intentionally minimal (cold start → first frame) because CI has no paired radio.
* Extend it with post-connection screens (node list, map, message thread) once a fake transport or
* connected device is available in the harness — the more representative the journey, the better the
* profile.
*/
Tf0883e@LargeTest
Tf0883e@RunWithTb4b4b4(Te6edf3AndroidJUnit4Tff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364BaselineProfileGenerator Tb4b4b4{

Tf0883e@getTb4b4b4:Te6edf3Rule Tff7b72val Te6edf3baselineProfileRule Tff7b72= Te6edf3BaselineProfileRuleTb4b4b4(Tb4b4b4)

Tf0883e@Test
Tff7b72fun Td2a8ffgenerateTb4b4b4(Tb4b4b4) Tff7b72=
Te6edf3baselineProfileRuleTb4b4b4.Te6edf3collectTb4b4b4(
T8b949e// The plugin injects the target applicationId (handles the google debug/release suffix).
Te6edf3packageName Tff7b72= Te6edf3InstrumentationRegistryTb4b4b4.Te6edf3getArgumentsTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3getStringTb4b4b4(Ta5d6ff"Ta5d6fftargetAppIdTa5d6ff"Tb4b4b4) Tff7b72?: Te6edf3DEFAULT_APP_IDTb4b4b4,
T8b949e// Also produce a startup profile (dexlayout hints) for faster cold start, not just AOT rules.
Te6edf3includeInStartupProfile Tff7b72= Tff7b72trueTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3pressHomeTb4b4b4(Tb4b4b4)
Te6edf3startActivityAndWaitTb4b4b4(Tb4b4b4)
Te6edf3deviceTb4b4b4.Te6edf3waitForIdleTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tff7b72private Tff7b72companion Tff7b72object Tb4b4b4{
Tff7b72const Tff7b72val Te6edf3DEFAULT_APP_ID Tff7b72= Ta5d6ff"Ta5d6ffcom.geeksville.meshTa5d6ff"
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.05s